﻿# -*- coding: utf-8 -*-
#!C:\Python31\python.exe
#FileName:readcfg.py
#python v3.1 for windows

import configparser
import sys
  
path = sys.path[0]	# 获取当前脚本路径
cfgfile = path+"\\config"	# 定义配置文件的全路径	
config = configparser.ConfigParser() # 调用读取配置文件方法
try: 
	config.readfp(open(cfgfile))	# 打开读取配置文件
except:
	print ("open failed!")
else:
	Server = config.get("Server","Server")	# 根据配置文件中的节点，取对应的值
	UserName = config.get("User","UserName")
	PassWord = config.get("User","PassWord")
	Port = config.getint("User","Port")
	backupdir = config.get("Path","backupdir")
	path1 = config.get("Path","path1")
	path2 = config.get("Path","path2")
	source = path1,path2
	remotepath = config.get("Path","remotepath")